﻿using System.Text.RegularExpressions;
using System.Diagnostics;
using System;
using System.IO;
using System.Windows.Forms;

using Nextensions.GUI;

namespace DotNetConverter
{
    public partial class Main : Form
    {
        public Main()
        {
            InitializeComponent();
            WindowState = FormWindowState.Minimized;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Convert();
        }

        private void Convert()
        {
            prConvert.Value = 0;
            prConvert.Maximum = 1;
            InputPersistence.SaveUserInput(cmInFile, "InFile");
            InputPersistence.SaveUserInput(cmOutFile, "OutFile");
            prConvert.Maximum = 1;
            prConvert.Value = 0;
            File.WriteAllText(cmOutFile.Text, Converter.VBtoCSharp(File.ReadAllText(cmInFile.Text)));
            prConvert.Value = 1;
        }

        private void Main_Load(object sender, System.EventArgs e)
        {
            InputPersistence.LoadUserInput(cmInFile, "InFile", true);
            InputPersistence.LoadUserInput(cmOutFile, "OutFile", true);

            Convert();
        }
    }
}
